<template>
	<view class="mt80 bgtmert">
		<view class="pd">
			<view class=" pr">
				<icon type="search" class="jhggsd" size="20"></icon>
				<input type="text" value="" placeholder="输入手机号" class="jhhgerttyt ag" @confirm="topost" v-model="keyword"/>
			</view>
			<!-- <view class="mt40">
				<uni-icons type="map" color="#1689D5" size="20"></uni-icons>
				<text class="ml10 cf fz26">当前定位：山东省</text>
			</view> -->
		</view>
		<view class="mt50" v-if="isshow">
		<view class="jhbkbjxdd  pd row"  v-for="(sd,idx) in userinfo" :key="idx">
			<view class="col row">
				<image :src="sd.avatar" class="yj usericond"></image>
				<view class="col pl30">
					<view class="fz32 cf">
						{{sd.nickname}}
					</view>
					<view class="mt20 fz26 z9">
						{{sd.phone}}
					</view>
				</view>
			</view>
			<view class="kjhjbnxert">
				<view class=" cz  f_b jjhkkxert cen cf fz32" @click="addmems(sd.id)">
					添加
				</view>
			</view>
		</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				datas:[],
				isshow:false,
				keyword:'',
				userinfo:[]
			}
		},
		components: {},
		onNavigationBarButtonTap(e) {
			uni.navigateBack({
				delta:1
			})
		},
		methods: {
			async getssq(){
				let cs = {}
				cs.keyword = this.keyword
				cs.is_search = 1
				let jhsd = await this.post("/api/users/search", cs)
				// let datas ={}
				// datas.id = 27
				// datas.avatar = "../../static/img/usericon.png"
				// datas.phone = 13305316666
				// datas.nickname = 'sldsdfl'
				console.log(jhsd);
				if(jhsd){
					this.userinfo = jhsd
					this.isshow = true
				}else{
					uni.showToast({
						title:'暂无此帐号'
					})
				}
				
			},
			topost(){
				console.log(this.keyword);
				this.getssq();
			}, 
			addmems(uid){
				let cs = {}
				cs.type = 2
				cs.id = uid
				cs.mode = 3
				let jhsd = this.post("/api/notice", cs) 
				console.log(jhsd)
				// let jhsd = this.post("/api/users/search", cs)
				if(jhsd.hasOwnProperty('data')){
					uni.showToast({
						title:'好友申请已发送',
						icon:"none"
					})
				}
				setTimeout(function(){
					uni.navigateBack({
						delta:1
					})
				},2000)
				
			}
		},
		onLoad(){
			
		},
		mounted() {}
	}
</script>
<style scoped>
	.jhhgerttyt.ag {
		padding-left: 120upx !important;
	}

	.jhggsd {
		position: absolute;
		left: 36upx;
		top: 30upx;
	}
	.jhbkbjxdd{
		padding-top: 45upx;
		padding-bottom: 45upx;
	}
	.kjhjbnxert{
		width: 140upx;
		line-height: 110upx;
		text-align: right;
	}
	.usericond{
		width: 100upx;
		height: 100upx;
	}
	.jjhkkxert{
		width:132upx;
		height:60upx;
		line-height: 60upx;
		background:rgba(22,137,213,1);
		border-radius:12upx;
	}
</style>
